@include('admin.header')
<style>
form{

	
}
label{
	line-height:40px;
}
label span{
	display: inline-block;
	width: 150px;
	text-align: right;
}
input[type="submit"]{
	position: absolute;
	right: 20px;
	bottom: 20px;
	margin-left: 20px;
	display: inline-block;
	text-align: right;
}




</style>
</head>
<body>
	<div class="wrap js-check-wrap">

		<form  method="post" class="js-ajax-tree js-category-add">
			<div>
			   <label>
				<span>货币英文简写：</span>
				<input type="text" style="width: 200px;height: 35px;" name="currency_type" value="{{$data->currency_type or ''}}"/>
				</label>
				<label>
				<span>存放汇率：</span>
				<input type="text" style="width: 200px;height: 35px;" name="exchange_rate" value="{{$data->exchange_rate or ''}}"/>
				</label>
				<label>
				<span>货币单位：</span>
				<input type="text" style="width: 200px;height: 35px;" name="currency_unit" value="{{$data->currency_unit or ''}}"/>
				</label>
				<input type="hidden" name="currencyid" value="{{$data->currencyid or ''}}"/>
				<input type="submit" class="btn btn-primary" value="提交" />
				
			</div>
		</form>
	</div>
	<script type="text/javascript" src="/static/js/common.js"></script>
	<script type="text/javascript" src="/static/js/validate/validate.js"></script>
	<script type="text/javascript" src="/static/js/layer/layer.js"></script>
	<script type="text/javascript">
			$(function() {
			$(".js-category-add").validate({
				rules: {
					currency_type: {
						required: true
					}
				},
				messages: {
					currency_type: {
						required: "币英文简写不为空"
					}
				},
				submitHandler: function () {
					$.post("/currency/{{$action}}",$('.js-category-add').serialize(), function (msg) {
						if (msg.status == 1) {
							layer.confirm(msg.info, {
								btn: ['确定']
							}, function(){
								@if($action == 'add_currency')
									window.parent.location.reload();
									var index = parent.layer.getFrameIndex(window.name);
									parent.layer.close(index);
								@endif
							});
						} else {
							showMsg(msg.info);
						}
					}, 'json');
					return false;
				}
			});
		});
		/**
		 * layer提示
		 */
		function showMsg(msg){
			layer.alert(msg, {
				title: '提示',
				icon: 2,
			});
		}
	</script>
</body>
</html>